﻿using System.IO;

namespace AlipaySDK.Alipay
{

    public class AlipayConfig
    {

        public static string alipay_public_key = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase.ToString() + "Pem\\alipay_rsa_public_key.pem";
        //这里要配置没有经过PKCS8转换的原始私钥
        public static string merchant_private_key = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase.ToString() + "Pem\\rsa_private_key.pem";
        public static string merchant_public_key = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase.ToString() + "Pem\\rsa_public_key.pem";
        public static string appId = "2016080501706794";
        public static string serverUrl = "https://openapi.alipay.com/gateway.do";
        public static string mapiUrl = "https://mapi.alipay.com/gateway.do";
        public static string pid = "2088421426952364";



        public static string charset = "utf-8";//"utf-8";
        public static string sign_type = "RSA";
        public static string version = "1.0";

        public static string SellerEmail = "hyzyyxxk@163.com";
        public static string AliPayKey = "gntvqxowekvlexggo782a24ryhgcqz8l";
        //无线产品密钥->支付宝公钥
        //MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2LJ8guj+zs43M48Qu55Zt0bYr+Y4QtEHarSoAb3OsyohcXu5YcisFgKmf3ADuNgI1fJ2nL4N5WxOylYj7k5NaKeEwshsZjXkaTaGOTZeExftQSn3nGD7O3IVJbmaMhA+SIgCUJPUmaJII/C0nYCyYndUe0nx6Ejue8yFBoCGzjwIDAQAB
        public static string WapAliPayPublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqnhWS3EPjzJTfMgc6n3jEyKhJYVBh1jER3oXV E2+Hf3DqhcSWcL3yjKw5w72h6/czXIEsYtBsDKMxcm/0b9lRvDzcj0L18hklLVgA1IHk0/TeCqbQ qMw4IHNBGvfwPsPI0LT0Y/4OGRCvFpoh0nESxN3tfYqgiKcq97rfPai1vwIDAQAB";

        //无线产品密钥->本地密钥
        public static string WapRSAPrivateKey = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAPYsnyC6P7OzjczjxC7nlm3Rtiv5jhC0QdqtKgBvc6zKiFxe7lhyKwWAqZ/cAO42AjV8nacvg3lbE7KViPuTk1op4TCyGxmNeRpNoY5Nl4TF+1BKfecYPs7chUluZoyED5IiAJQk9SZokgj8LSdgLJid1R7SfHoSO57zIUGgIbOPAgMBAAECgYEAw/MEvwJBjoLPzlVGZaeFv+h7v0knYfh5qtzHYA1W4CVeoVgXFGPcBsdBPbPbMcHfxD9rJhbV6hUq+q24mbgAQub1wf+GeID9vm+T3vG9BmaJxtLx8J/PxYKjuFTtuoItvk2nCQWZQVvJexNSQ97K7FGHs2YyrFmWWWzV3hrjgwECQQD/8BCz+P7pkM1nj90z/DB6/IhrV8/jxI84AJGDVmS4jpic2snXXOAoIJt7NKanhy47DRClI+Q6aFJDPoZhfvVPAkEA9jvyzwyZgmD3dEZJcBNTGQHqMMjkJkYG+stj4+1sbjFsVjxrf6YoXsvT7WX2MI9MHV72qUwMklpHIETTcb5NwQJBAPJp9cghXYDosEUZFJF6mojCzIuvnq7DrEuE7k6R89CC77YR3P/pbj9TszDdS8R926H+2/cuqatQyCn8/Nc3oy0CQAxtwjfJPwZhtpvb4GET2KHugs+rlDiKWFfYZFZg6ZQ2Um2X5yUuUeNXDn9xIhgZY5In9PNer1PD0stCLhoTrQECQCdPIonE9zVplL4x1x5ZiZCGRSApG1jjR6gDElZonQO+jisfijpaOPkSnUGkzXLuppgJ54avqoapEi3Srlvvco4=";
        //合作伙伴密钥->支付宝公钥
        //MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/H41HfBdyfu31dt9+SXnhhl3nHDEDFKjOBymNTbxtF+z5XVgIku/OxIzTQWvzKtXqZOIU/yITRYUzYpmvb84J1I3j7eTbxozzL3Q9E7XbIv98sIx4fFQtQYWY6htpqXQDDIZ4jf5063PSxZRSNvwafopUHh5miVntfRDD0hcL3QIDAQAB
        public static string PartnerAliPayPublicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB";
        //合作伙伴密钥->本地密钥
        public static string PartnerRSAPrivateKey = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAL8fjUd8F3J+7fV2335JeeGGXeccMQMUqM4HKY1NvG0X7PldWAiS787EjNNBa/Mq1epk4hT/IhNFhTNima9vzgnUjePt5NvGjPMvdD0Ttdsi/3ywjHh8VC1BhZjqG2mpdAMMhniN/nTrc9LFlFI2/Bp+ilQeHmaJWe19EMPSFwvdAgMBAAECgYEAkPqsPxfA6Zejhtp/utqd3BgDT3cxLrcTPgZs3MWlM9Q8bQUD7K0ZwG2UrgQokTNjRgT1AxxuitPnsQ0Qq+ZSEg2ey+wqZOat3n+09q4/1LaqYr+wsnWlJKPB2VDjrox0M8hUAcMIxkH8REumCVeCfXaepPw21mkgox/bvzkqNcECQQD0vWNq6BUUVD5T9apnXProoe2bIvIwGa/gt88zO91mDWoZSy2IMwttpIYkMSneYMej0qYy0hjSj5mMFWvRWiJ5AkEAx+qnPaySs6Yq4pU1PDsI9SaweOmu92X9qsIAHqPRLtHWuwVwiUSH6Rc+/r7IKrx7KzvbjJcXThi2K3b/SIt7hQJBANCMyjkBR2UpXGtjPjASVWUDB1xZbRN78BmHyDKaYtFhwPWI0GXtSWHG/t+8XTc4NSbui91mluxmnat3XYbqTdECQQCPiETsvdNSElKl/XSMOuJyiIWZOkX5sAtRJxpI5VrRn6zo973VgBOIYb1DzxwNuuc/oik+JliAJLPePwCISES1AkBQLeReOhA1l9zmHtztHPBHsQL01j/f+PLY8/NgmkmqBhp2W4l7qc5jSXGBxMQiQCZxn1LQvos+wroaVS7PJX8C";

        public static string SignType = "0001";


        public AlipayConfig()
        {
            //
        }

        public static string getMerchantPublicKeyStr()
        {
            StreamReader sr = new StreamReader(merchant_public_key);
            string pubkey = sr.ReadToEnd();
            sr.Close();
            if (pubkey != null)
            {
                pubkey = pubkey.Replace("-----BEGIN PUBLIC KEY-----", "");
                pubkey = pubkey.Replace("-----END PUBLIC KEY-----", "");
                pubkey = pubkey.Replace("\r", "");
                pubkey = pubkey.Replace("\n", "");
            }
            return pubkey;
        }

        public static string getMerchantPriveteKeyStr()
        {
            StreamReader sr = new StreamReader(merchant_private_key);
            string pubkey = sr.ReadToEnd();
            sr.Close();
            if (pubkey != null)
            {
                pubkey = pubkey.Replace("-----BEGIN PUBLIC KEY-----", "");
                pubkey = pubkey.Replace("-----END PUBLIC KEY-----", "");
                pubkey = pubkey.Replace("\r", "");
                pubkey = pubkey.Replace("\n", "");
            }
            return pubkey;
        }

    }
}
